package cn.school.thoughtworks.section2;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class PracticeA {
    Map<String,Integer> countSameElements(List<String> collection1) {


            Map<String, Integer> map = new HashMap();

            collection1.forEach(name -> map.compute(name, (k, v) -> v == null ? 1 : ++v));
            return map;
    }
}
